3.3.48 \(\int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx\) [248]

3.3.48.1 Optimal result
3.3.48.2 Mathematica [A] (verified)
3.3.48.3 Rubi [A] (verified)
3.3.48.4 Maple [A] (verified)
3.3.48.5 Fricas [A] (verification not implemented)
3.3.48.6 Sympy [F]
3.3.48.7 Maxima [F(-2)]
3.3.48.8 Giac [A] (verification not implemented)
3.3.48.9 Mupad [B] (verification not implemented)

3.3.48.1 Optimal result

Integrand size = 29, antiderivative size = 76 \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx=\frac {b \text {arctanh}(\sin (e+f x))}{d f}-\frac {2 (b c-a d) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{\sqrt {c-d} d \sqrt {c+d} f} \]

output
b*arctanh(sin(f*x+e))/d/f-2*(-a*d+b*c)*arctanh((c-d)^(1/2)*tan(1/2*f*x+1/2 
*e)/(c+d)^(1/2))/d/f/(c-d)^(1/2)/(c+d)^(1/2)
 
3.3.48.2 Mathematica [A] (verified)

Time = 0.48 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.47 \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx=\frac {\frac {2 (b c-a d) \text {arctanh}\left (\frac {(-c+d) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{\sqrt {c^2-d^2}}+b \left (-\log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )+\log \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )}{d f} \]

input
Integrate[(Sec[e + f*x]*(a + b*Sec[e + f*x]))/(c + d*Sec[e + f*x]),x]
 
output
((2*(b*c - a*d)*ArcTanh[((-c + d)*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/Sqrt 
[c^2 - d^2] + b*(-Log[Cos[(e + f*x)/2] - Sin[(e + f*x)/2]] + Log[Cos[(e + 
f*x)/2] + Sin[(e + f*x)/2]]))/(d*f)
 
3.3.48.3 Rubi [A] (verified)

Time = 0.48 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.276, Rules used = {3042, 4486, 3042, 4257, 4318, 3042, 3138, 221}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\csc \left (e+f x+\frac {\pi }{2}\right ) \left (a+b \csc \left (e+f x+\frac {\pi }{2}\right )\right )}{c+d \csc \left (e+f x+\frac {\pi }{2}\right )}dx\)

\(\Big \downarrow \) 4486

\(\displaystyle \frac {b \int \sec (e+f x)dx}{d}-\frac {(b c-a d) \int \frac {\sec (e+f x)}{c+d \sec (e+f x)}dx}{d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {b \int \csc \left (e+f x+\frac {\pi }{2}\right )dx}{d}-\frac {(b c-a d) \int \frac {\csc \left (e+f x+\frac {\pi }{2}\right )}{c+d \csc \left (e+f x+\frac {\pi }{2}\right )}dx}{d}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {b \text {arctanh}(\sin (e+f x))}{d f}-\frac {(b c-a d) \int \frac {\csc \left (e+f x+\frac {\pi }{2}\right )}{c+d \csc \left (e+f x+\frac {\pi }{2}\right )}dx}{d}\)

\(\Big \downarrow \) 4318

\(\displaystyle \frac {b \text {arctanh}(\sin (e+f x))}{d f}-\frac {(b c-a d) \int \frac {1}{\frac {c \cos (e+f x)}{d}+1}dx}{d^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {b \text {arctanh}(\sin (e+f x))}{d f}-\frac {(b c-a d) \int \frac {1}{\frac {c \sin \left (e+f x+\frac {\pi }{2}\right )}{d}+1}dx}{d^2}\)

\(\Big \downarrow \) 3138

\(\displaystyle \frac {b \text {arctanh}(\sin (e+f x))}{d f}-\frac {2 (b c-a d) \int \frac {1}{\left (1-\frac {c}{d}\right ) \tan ^2\left (\frac {1}{2} (e+f x)\right )+\frac {c+d}{d}}d\tan \left (\frac {1}{2} (e+f x)\right )}{d^2 f}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {b \text {arctanh}(\sin (e+f x))}{d f}-\frac {2 (b c-a d) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{d f \sqrt {c-d} \sqrt {c+d}}\)

input
Int[(Sec[e + f*x]*(a + b*Sec[e + f*x]))/(c + d*Sec[e + f*x]),x]
 
output
(b*ArcTanh[Sin[e + f*x]])/(d*f) - (2*(b*c - a*d)*ArcTanh[(Sqrt[c - d]*Tan[ 
(e + f*x)/2])/Sqrt[c + d]])/(Sqrt[c - d]*d*Sqrt[c + d]*f)
 

3.3.48.3.1 Defintions of rubi rules used

rule 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3138
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ 
e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d)   Subst[Int[1/(a + b + 
(a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] 
 && NeQ[a^2 - b^2, 0]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 

rule 4318
Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbo 
l] :> Simp[1/b   Int[1/(1 + (a/b)*Sin[e + f*x]), x], x] /; FreeQ[{a, b, e, 
f}, x] && NeQ[a^2 - b^2, 0]
 

rule 4486
Int[(csc[(e_.) + (f_.)*(x_)]*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)))/(csc[( 
e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[B/b   Int[Csc[e + f*x], 
 x], x] + Simp[(A*b - a*B)/b   Int[Csc[e + f*x]/(a + b*Csc[e + f*x]), x], x 
] /; FreeQ[{a, b, e, f, A, B}, x] && NeQ[A*b - a*B, 0]
 
3.3.48.4 Maple [A] (verified)

Time = 0.77 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.21

method result size
derivativedivides \(\frac {\frac {b \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{d}-\frac {b \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{d}-\frac {2 \left (-a d +b c \right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{d \sqrt {\left (c +d \right ) \left (c -d \right )}}}{f}\) \(92\)
default \(\frac {\frac {b \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{d}-\frac {b \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{d}-\frac {2 \left (-a d +b c \right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{d \sqrt {\left (c +d \right ) \left (c -d \right )}}}{f}\) \(92\)
risch \(\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) a}{\sqrt {c^{2}-d^{2}}\, f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) b c}{\sqrt {c^{2}-d^{2}}\, f d}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i c^{2}-i d^{2}-\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) a}{\sqrt {c^{2}-d^{2}}\, f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i c^{2}-i d^{2}-\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) b c}{\sqrt {c^{2}-d^{2}}\, f d}-\frac {b \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}{d f}+\frac {b \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}{d f}\) \(331\)

input
int(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x,method=_RETURNVERBOSE)
 
output
1/f*(b/d*ln(tan(1/2*f*x+1/2*e)+1)-b/d*ln(tan(1/2*f*x+1/2*e)-1)-2/d*(-a*d+b 
*c)/((c+d)*(c-d))^(1/2)*arctanh((c-d)*tan(1/2*f*x+1/2*e)/((c+d)*(c-d))^(1/ 
2)))
 
3.3.48.5 Fricas [A] (verification not implemented)

Time = 0.63 (sec) , antiderivative size = 316, normalized size of antiderivative = 4.16 \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx=\left [-\frac {{\left (b c - a d\right )} \sqrt {c^{2} - d^{2}} \log \left (\frac {2 \, c d \cos \left (f x + e\right ) - {\left (c^{2} - 2 \, d^{2}\right )} \cos \left (f x + e\right )^{2} + 2 \, \sqrt {c^{2} - d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )} \sin \left (f x + e\right ) + 2 \, c^{2} - d^{2}}{c^{2} \cos \left (f x + e\right )^{2} + 2 \, c d \cos \left (f x + e\right ) + d^{2}}\right ) - {\left (b c^{2} - b d^{2}\right )} \log \left (\sin \left (f x + e\right ) + 1\right ) + {\left (b c^{2} - b d^{2}\right )} \log \left (-\sin \left (f x + e\right ) + 1\right )}{2 \, {\left (c^{2} d - d^{3}\right )} f}, -\frac {2 \, {\left (b c - a d\right )} \sqrt {-c^{2} + d^{2}} \arctan \left (-\frac {\sqrt {-c^{2} + d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )}}{{\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}\right ) - {\left (b c^{2} - b d^{2}\right )} \log \left (\sin \left (f x + e\right ) + 1\right ) + {\left (b c^{2} - b d^{2}\right )} \log \left (-\sin \left (f x + e\right ) + 1\right )}{2 \, {\left (c^{2} d - d^{3}\right )} f}\right ] \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="frica 
s")
 
output
[-1/2*((b*c - a*d)*sqrt(c^2 - d^2)*log((2*c*d*cos(f*x + e) - (c^2 - 2*d^2) 
*cos(f*x + e)^2 + 2*sqrt(c^2 - d^2)*(d*cos(f*x + e) + c)*sin(f*x + e) + 2* 
c^2 - d^2)/(c^2*cos(f*x + e)^2 + 2*c*d*cos(f*x + e) + d^2)) - (b*c^2 - b*d 
^2)*log(sin(f*x + e) + 1) + (b*c^2 - b*d^2)*log(-sin(f*x + e) + 1))/((c^2* 
d - d^3)*f), -1/2*(2*(b*c - a*d)*sqrt(-c^2 + d^2)*arctan(-sqrt(-c^2 + d^2) 
*(d*cos(f*x + e) + c)/((c^2 - d^2)*sin(f*x + e))) - (b*c^2 - b*d^2)*log(si 
n(f*x + e) + 1) + (b*c^2 - b*d^2)*log(-sin(f*x + e) + 1))/((c^2*d - d^3)*f 
)]
 
3.3.48.6 Sympy [F]

\[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx=\int \frac {\left (a + b \sec {\left (e + f x \right )}\right ) \sec {\left (e + f x \right )}}{c + d \sec {\left (e + f x \right )}}\, dx \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x)
 
output
Integral((a + b*sec(e + f*x))*sec(e + f*x)/(c + d*sec(e + f*x)), x)
 
3.3.48.7 Maxima [F(-2)]

Exception generated. \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx=\text {Exception raised: ValueError} \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="maxim 
a")
 
output
Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*c^2-4*d^2>0)', see `assume?` f 
or more de
 
3.3.48.8 Giac [A] (verification not implemented)

Time = 0.35 (sec) , antiderivative size = 127, normalized size of antiderivative = 1.67 \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx=\frac {\frac {b \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right )}{d} - \frac {b \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right )}{d} + \frac {2 \, {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, c - 2 \, d\right ) + \arctan \left (\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-c^{2} + d^{2}}}\right )\right )} {\left (b c - a d\right )}}{\sqrt {-c^{2} + d^{2}} d}}{f} \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="giac" 
)
 
output
(b*log(abs(tan(1/2*f*x + 1/2*e) + 1))/d - b*log(abs(tan(1/2*f*x + 1/2*e) - 
 1))/d + 2*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(2*c - 2*d) + arctan((c*ta 
n(1/2*f*x + 1/2*e) - d*tan(1/2*f*x + 1/2*e))/sqrt(-c^2 + d^2)))*(b*c - a*d 
)/(sqrt(-c^2 + d^2)*d))/f
 
3.3.48.9 Mupad [B] (verification not implemented)

Time = 14.54 (sec) , antiderivative size = 573, normalized size of antiderivative = 7.54 \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx=\frac {a\,c^2\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,{\left (c^2-d^2\right )}^{3/2}}-\frac {a\,d^2\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,{\left (c^2-d^2\right )}^{3/2}}-\frac {2\,b\,d\,\mathrm {atanh}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,\left (c^2-d^2\right )}-\frac {a\,\ln \left (\frac {c\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {\left (c+d\right )\,\left (c-d\right )}}{f\,\left (c^2-d^2\right )}+\frac {b\,c\,d\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,{\left (c^2-d^2\right )}^{3/2}}+\frac {2\,b\,c^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{d\,f\,\left (c^2-d^2\right )}-\frac {b\,c^3\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{d\,f\,{\left (c^2-d^2\right )}^{3/2}}+\frac {b\,c\,\ln \left (\frac {c\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {\left (c+d\right )\,\left (c-d\right )}}{d\,f\,\left (c^2-d^2\right )} \]

input
int((a + b/cos(e + f*x))/(cos(e + f*x)*(c + d/cos(e + f*x))),x)
 
output
(a*c^2*log((c*sin(e/2 + (f*x)/2) - d*sin(e/2 + (f*x)/2) + cos(e/2 + (f*x)/ 
2)*(c^2 - d^2)^(1/2))/cos(e/2 + (f*x)/2)))/(f*(c^2 - d^2)^(3/2)) - (a*d^2* 
log((c*sin(e/2 + (f*x)/2) - d*sin(e/2 + (f*x)/2) + cos(e/2 + (f*x)/2)*(c^2 
 - d^2)^(1/2))/cos(e/2 + (f*x)/2)))/(f*(c^2 - d^2)^(3/2)) - (2*b*d*atanh(s 
in(e/2 + (f*x)/2)/cos(e/2 + (f*x)/2)))/(f*(c^2 - d^2)) - (a*log((c*cos(e/2 
 + (f*x)/2) + d*cos(e/2 + (f*x)/2) - sin(e/2 + (f*x)/2)*(c^2 - d^2)^(1/2)) 
/cos(e/2 + (f*x)/2))*((c + d)*(c - d))^(1/2))/(f*(c^2 - d^2)) + (b*c*d*log 
((c*sin(e/2 + (f*x)/2) - d*sin(e/2 + (f*x)/2) + cos(e/2 + (f*x)/2)*(c^2 - 
d^2)^(1/2))/cos(e/2 + (f*x)/2)))/(f*(c^2 - d^2)^(3/2)) + (2*b*c^2*atanh(si 
n(e/2 + (f*x)/2)/cos(e/2 + (f*x)/2)))/(d*f*(c^2 - d^2)) - (b*c^3*log((c*si 
n(e/2 + (f*x)/2) - d*sin(e/2 + (f*x)/2) + cos(e/2 + (f*x)/2)*(c^2 - d^2)^( 
1/2))/cos(e/2 + (f*x)/2)))/(d*f*(c^2 - d^2)^(3/2)) + (b*c*log((c*cos(e/2 + 
 (f*x)/2) + d*cos(e/2 + (f*x)/2) - sin(e/2 + (f*x)/2)*(c^2 - d^2)^(1/2))/c 
os(e/2 + (f*x)/2))*((c + d)*(c - d))^(1/2))/(d*f*(c^2 - d^2))